#!/bin/bash

echo "🚀 Starting Module Federation X Development Environment"
echo ""

# 检查是否安装了依赖
if [ ! -d "node_modules" ]; then
    echo "📦 Installing dependencies..."
    npm install
    npm run bootstrap
fi

echo "🔧 Starting development servers..."
echo ""
echo "Please open 4 terminal windows and run these commands:"
echo ""
echo "Terminal 1 (Math Module):"
echo "cd packages/math && npm run dev"
echo ""
echo "Terminal 2 (Calculator UI):"
echo "cd packages/calculatorUI && npm run dev"
echo ""
echo "Terminal 3 (Main App):"
echo "cd packages/app && npm run dev"
echo ""
echo "Terminal 4 (Optional - Production Server):"
echo "npm run build:all"
echo ""
echo "🌐 Access URLs:"
echo "- Main App (Development): http://localhost:3000"
echo "- Math Module: http://localhost:3001"
echo "- Calculator UI: http://localhost:3002"
echo "- Production Server: http://localhost:8080"
echo ""
echo "💡 Open browser DevTools to observe module loading behavior!"